<template>
	<view class="">
		<u-navbar title="退款/售后" placeholder autoBack></u-navbar>
		<view class="p-2 bg-white mt-2" v-for="(item,index) in list" :key="item.id">
			<view class="flex align-center justify-between">
				<view class="text-main font-28">订单号:{{item.order_no}}</view>
				<view class="font-28" style="color:#EB463E;">{{item.goods_order[0].service_order.type===1?'退款':'退款退货'}}</view>
			</view>
			<view class="mt-2" v-for="(goodsItem,goodsIndex) in item.goods_order" :key="goodsIndex">
				<orderItem :item="goodsItem" type="order" @click=""></orderItem>
			</view>
			
			<view class="p-2 flex align-center mt-2" style="background: #F9F9F9;">
				<view class="font-sm text-main font-weight-bold" style="width: 200rpx;">{{item|check}}</view>
				<view v-if="(item.goods_order[0].service_order.type===2&&$u.test.isEmpty(item.goods_order[0].service_order.express_no)&&item.goods_order[0].service_order.check==='1')" class="ml-2 font-28 text-main">请提交退货物流信息</view>
				<view v-if="(item.goods_order[0].service_order.check==='2')" class="ml-2 font-28 text-main">{{item.goods_order[0].service_order.refusal_reason}}</view>
			</view>
			
			<view class="flex align-center justify-end mt-2">
				<view class="flex align-center justify-center detail"  @click.stop="$u.route('pages/user/aftersale/detail',{orderId:item.id,ordergoodsId:item.goods_order[0].id})">查看详情</view>	
			</view>
				
		</view>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				page:1,
				list:[]
			}
		},
		filters:{
			
			check(value){
				let serviceorder = value.goods_order[0].service_order
				let goodsorder = value.goods_order[0]
				if(serviceorder.check === '0'){
					return '平台审核中'
				}
				if(serviceorder.check === '1'){
					if(goodsorder.refund_status===0){
						return '退款中'
					}
					if(goodsorder.refund_status===1){
						return '退款成功'
					}
				}
				if(serviceorder.check === '2'){
					return '拒绝'
				}
				
			}
		},
		onShow() {
			this.getDataList()
		},
		methods:{
			getDataList(){
				let parmar = {
					type:'6',
					page:this.page
				}
				this.$api.myOrder(parmar).then(res=>{
					if(res.code === 1){
						
						this.list = res.data
						
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.detail{
		width: 156rpx;
		height: 56rpx;
		background: linear-gradient(180deg, #04BF79 0%, #02BC6B 100%);
		border-radius: 202rpx 202rpx 202rpx 202rpx;
		opacity: 1;
		font-size: 24rpx;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
	}
</style>